package com.controller;

import com.annotation.IgnoreAuth;
import com.entity.BlanketOrder;
import com.service.KitchenSupervisorService;
import com.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import java.util.List;

@Api(tags  = "厨房主管模块")
@RestController
@RequestMapping("/KitchenSupervisor")
@Slf4j
public class KitchenSupervisorController {

    @Autowired
    private KitchenSupervisorService kitchenSupervisorService;

    @IgnoreAuth
    @ApiOperation("导出总订单")
    @GetMapping("/placeAllOrder")
    public R placeDailyOrder(HttpServletRequest request, HttpServletResponse response) throws IOException{
        try {
            log.info("KitchenSupervisorController.placeAllOrder...");
            kitchenSupervisorService.getAllOrder(request, response);

            log.info("placeAllOrder Over-----------------------");
            return R.ok();
        } catch (IOException e) {
            return R.ok();
        }
        //return R.ok();
    }

    //@IgnoreAuth
    //@ApiOperation("配餐员批量导出日订单")
    //@GetMapping("/catererExportsOailyOrders")
    //public R AllDailyOrder(@RequestParam String userName){
    //    log.info("KitchenSupervisorController.catererExportsOailyOrders配餐员批量导出日订单...");
    //    List<User> blanketOrderList = kitchenSupervisorService.getAllPersonalOrder(userName);
    //
    //    return R.ok();
    //}

    @RequestMapping(value = "/downloadExcel", method = RequestMethod.GET)
    @ApiOperation("厨房主管导出日订单")
    public R downloadExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam String userName) throws IOException {
        log.info("KitchenSupervisorController.downloadExcel...");
        kitchenSupervisorService.downloadExcel(request,response,userName);
        log.info("------------------Controller...");
        return R.ok();
    }







}
